home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2003 June / macformat-130.iso / mac / Reviewed⁄Demos / Spearhead Demo / demota / pak1.pk3 / anim / crouch.scr < prev    next >
Encoding:
Text File  |  2002-10-21  |  4.6 KB  |  207 lines

  1. //--------
  2. // Crouch
  3. //--------
  4. // Called when the character has to crouch.  Check to see if it's doing anything else 
  5. // and play the appropriate animation to make it crouch.
  6. //println "Entering crouch.scr"
  7.  
  8. waitexec anim/default_inithandler.scr
  9. waitexec anim/smoking.scr::SmokeRemoveCigarette
  10.  
  11. switch (self.position)
  12. {
  13.     stand:
  14.     walk:
  15.     run:
  16.         // Play an animation to make him crouch down
  17.         // For now let's just go straight to the crouch animation - if it looks like 
  18.         // it needs a transition, we can make one later.
  19.         
  20.         self.blendtime = 0.5    // Use crossblend instead of a real transition animation
  21.         
  22.         switch (self.weapongroup)
  23.         {
  24.             pistol:
  25.             rifle:
  26.             mp40:
  27.             mp44:
  28.             bar:
  29.             thompson:
  30.             bazooka:
  31.             grenade:
  32.                 self setmotionanim (self.weapongroup + "_crouch_alert")
  33.                 break
  34.  
  35.             unarmed:
  36.                 self setmotionanim unarmed_crouch_alert
  37.                 break
  38.             
  39.             default:
  40.                 println "^~^~^ Stand -> Crouch/Default Case for " self.weapongroup " - fix crouch.scr"
  41.                 self setmotionanim rifle_crouch_alert
  42.                 break
  43.         }
  44.         //self waittill flaggedanimdone
  45.         // Wait the crossblend time to get down properly.  Set the position halfway through since we can.
  46.         wait 0.25 
  47.         self.position = crouch
  48.         wait 0.25 
  49.         break
  50.  
  51.     crouch:
  52.     crouchwalk:
  53.     crouchrun:
  54.         switch (self.weapongroup)
  55.         {
  56.             pistol:
  57.                 self setmotionanim pistol_crouch_alert
  58.                 break
  59.  
  60.             mp40:
  61.             mp44:
  62.             bar:
  63.             thompson:
  64.             bazooka:
  65.             rifle:
  66.                 //println "Crouch Idle/With Rifle"
  67.                 if (self.ground == beach)
  68.                 {
  69.                     self setmotionanim crouch_beach_idle
  70.                 }
  71.                 else
  72.                 {
  73.                     // Need a good animation for this...
  74.                     self setmotionanim (self.weapongroup + "_crouch_alert")
  75.                 }
  76.                 break
  77.  
  78.             grenade:
  79.                 println "Crouch idle with Grenade!  Should never happen!  Aaargh!"
  80.                 self setmotionanim rifle_crouch_alert
  81.                 break
  82.  
  83.             unarmed:
  84.                 self setmotionanim unarmed_crouch_alert
  85.                 break
  86.             
  87.             default:
  88.                 println ("^~^~^ Crouch Idle/Default case for "+self.weapongroup+" weapon group - fix crouch.scr")
  89.                 self setmotionanim rifle_crouch_alert
  90.                 break
  91.         }
  92.         self waittill flaggedanimdone
  93.         self.position = crouch
  94.         break
  95.  
  96.     prone:
  97.     pronewalk:
  98.         // Play an animation to make him get up to a crouch
  99.         self.blendtime = 0.5
  100.         switch (self.weapongroup)
  101.         {
  102.             pistol:
  103.             rifle:
  104.             mp40:
  105.             mp44:
  106.             bar:
  107.             thompson:
  108.                 self setmotionanim (self.weapongroup + "_pronetocrouch")
  109.                 break
  110.  
  111.             unarmed:
  112.                 self setmotionanim pistol_pronetocrouch
  113.                 break
  114.  
  115.             bazooka:
  116.                 //no bazooka anim for this use rifle instead
  117.                 self setmotionanim rifle_crouch_alert
  118.                 break
  119.  
  120.             default:
  121.                 println "^~^~^ Prone -> Crouch/Default Case for " self.weapongroup "(shouldn't happen (crouch.scr))"
  122.                 self setmotionanim (rifle_pronetocrouch)
  123.                 break
  124.         }
  125.  
  126.         self waittill flaggedanimdone        
  127.         self.position = crouch
  128.         break
  129.  
  130.     floor:
  131.     crawl:
  132.     knees:
  133.     default:
  134.         // I think I handled every case, so this is an error case
  135.         println "^~^~^ Crouch default case for position " self.position " - fix crouch.scr"
  136.         self setmotionanim rifle_crouch_alert
  137.         self waittill flaggedanimdone
  138.         self.position = crouch
  139.         break
  140. }
  141. end
  142.  
  143. //======================================================================
  144. //======================================================================
  145.  
  146. // allowed terminate immediately
  147. transition:
  148. switch (self.position)
  149. {
  150.     stand:
  151.     walk:
  152.     run:
  153.     crouch:
  154.     crouchwalk:
  155.     crouchrun:
  156.         self.position = crouch
  157.         break // can crossblend directly from these
  158.  
  159.     prone:
  160.     pronewalk:
  161.         // Play an animation to make him get up to a crouch
  162.         self.blendtime = 0.5
  163.         switch (self.weapongroup)
  164.         {
  165.             pistol:
  166.             rifle:
  167.             mp40:
  168.             mp44:
  169.             bar:
  170.             thompson:
  171.                 self setmotionanim (self.weapongroup + "_pronetocrouch")
  172.                 break
  173.  
  174.             bazooka:
  175.                 //no bazooka anim for this use rifle instead
  176.                 self setmotionanim rifle_crouch_alert
  177.                 break
  178.  
  179.             unarmed:
  180.                 //no unarmed anim for this use pistol instead
  181.                 self setmotionanim pistol_crouch_alert
  182.                 break
  183.  
  184.             default:
  185.                 println "^~^~^ Prone -> Crouch transition /Default Case for " self.weapongroup "(shouldn't happen (crouch.scr))"
  186.                 self setmotionanim (rifle_pronetocrouch)
  187.                 break
  188.         }
  189.  
  190.         self waittill flaggedanimdone        
  191.         self.position = crouch
  192.         break
  193.  
  194.     floor:
  195.     crawl:
  196.     knees:
  197.     default:
  198.         // I think I handled every case, so this is an error case
  199.         println "^~^~^ Crouch transition default case for position " self.position " - fix crouch.scr"
  200.         self setmotionanim rifle_crouch_alert
  201.         self waittill flaggedanimdone
  202.         self.position = crouch
  203.         break // can crossblend directly from these
  204. }
  205.  
  206. end
  207.